package fm.douban;

/*
 * UIExampleListStyleButtonSetScreen.java
 */

import net.rim.device.api.system.Bitmap;
import fm.douban.component.ForegroundManager;
import fm.douban.component.ListStyleButtonField;
import fm.douban.component.ListStyleButtonSet;
import fm.douban.component.UIExampleScreen;

public class ChannelScreen extends UIExampleScreen {

	private Bitmap _caret = Bitmap
			.getBitmapResource("chevron_right_black_15x22.png");
	private ForegroundManager _foreground;
	private SongPlayScreen _s;

	public ChannelScreen() {

	}

	public ChannelScreen(SongPlayScreen _s) {
		super( /* Manager.NO_VERTICAL_SCROLL | */USE_ALL_HEIGHT);
		this._s = _s;
		// setTitle(SongPlayScreen._resources
		// .getString(RadioResource.TITLE_CHANNEL));

		_foreground = new ForegroundManager();

		// LabelField verticalLabel = new LabelField(LoginUtil.getEmail());
		// verticalLabel.setPadding(5, 15, 5, 15);
		// _foreground.add(verticalLabel);

		ListStyleButtonSet buttonSet = new ListStyleButtonSet();

		ListStyleButtonField link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.PERSONAL),
				_caret, Channel.PERSONAL);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources
						.getString(RadioResource.BEATLES_CHINESE),
				_caret, Channel.BEATLES_CHINESE);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.GIRLS),
				_caret, Channel.GIRLS);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.CANTONESE),
				_caret, Channel.CANTONESE);
		buttonSet.add(link);
		
		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.ROCK),
				_caret, Channel.ROCK);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.BALLAD),
				_caret, Channel.BALLAD);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.LIGHT_MUSIC),
				_caret, Channel.LIGHT_MUSIC);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.SEVENTIES),
				_caret, Channel.SEVENTIES);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.EIGHTIES),
				_caret, Channel.EIGHTIES);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.NINETIES),
				_caret, Channel.NINETIES);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources
						.getString(RadioResource.MOVIE_ORIGINAL),
				_caret, Channel.MOVIE_ORIGINAL);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.JAZZ),
				_caret, Channel.JAZZ);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.RAP), _caret,
				Channel.RAP);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.RB), _caret,
				Channel.RB);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.JAPANESE),
				_caret, Channel.JAPANESE);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.KOREAN),
				_caret, Channel.KOREAN);
		buttonSet.add(link);

		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.PUMA),
				_caret, Channel.PUMA);
		buttonSet.add(link);
		
		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.OMP),
				_caret, Channel.OMP);
		buttonSet.add(link);
		
		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.FRENCH),
				_caret, Channel.FRENCH);
		buttonSet.add(link);
		
		link = new MyListStyleButtonField(
				SongPlayScreen._resources.getString(RadioResource.GEGE),
				_caret, Channel.GEGE);
		buttonSet.add(link);

		_foreground.add(buttonSet);

		add(_foreground);
	}

	private class MyListStyleButtonField extends ListStyleButtonField {
		private int c = 0;

		public MyListStyleButtonField(String label, Bitmap actionIcon, int c) {
			super(label, actionIcon);
			this.c = c;
		}

		public void clickButton() {
			_s.channelSwitch(c);
			onClose();
			super.clickButton();
		}

	}
}
